-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move tests from doctest to Catch2 #301
Move tests from doctest to Catch2 #301
Conversation
@Alex-PLACET I had problems with the set-up and I couldn't test locally, but I'll gladly test if you could give me a hand :) |
test/CMakeLists.txt
Outdated
@@ -101,6 +102,17 @@ target_link_libraries(${test_target} | |||
include(doctest) | |||
doctest_discover_tests(${test_target}) | |||
|
|||
set(test_target_catch2 "test_sparrow_lib_catch2") | |||
|
|||
add_executable(${test_target_catch2} ${SPARROW_TESTS_SOURCES}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not use SPARROW_TESTS_SOURCES
but only test_algorithm.cpp
test/CMakeLists.txt
Outdated
DEPENDS ${test_target} | ||
COMMENT "Running tests with JUnit report saved to: ${JUNIT_REPORT_FILE}" | ||
COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true | ||
COMMAND ${test_target_catch2} --reporters=better_junit --out=${JUNIT_REPORT_FILE_CATCH2} --no-path-filenames=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not use the same options as doctest, please check: https://github.com/catchorg/Catch2/blob/devel/docs/command-line.md
Sure, how can I help you ? Where is your issue ? |
btw, I approved the run on the CI: https://github.com/man-group/sparrow/pull/301/checks |
@Gulin7 According to the documentation, you need to link the Catch2::Catch2WithMain cmake target and not Catch2::Catch2 |
@Alex-PLACET I've tried Catch2::Catch2WithMain and I get the same error as before |
sparrow-17-13-20.patch |
Thank you, the build worked locally! :) I've ran both the tests with Catch2 and the ones with Doctest and they were successful. |
To fix the issue with MSVC compilation: |
environment-dev.yml
Outdated
- howardhinnant_date | ||
# Documentation | ||
- doxygen | ||
- graphviz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is the issue but can you revert the indent be sure that you have blank line ?
https://github.com/man-group/sparrow/actions/runs/12066345620/job/33646992095?pr=301
To fix the compilation on Windows with VCPKG, you have to force the build type to release: |
On exotic architectures, we get an old version of catch2 (version 2.13): |
Isn't there a way to enforce Catch2 >= 3.0.0? |
I will try to update exotic architectures images to ubuntu 22.04 |
Ok, hopefully that fixes it. I've added |
Hmmm, finally forcing VCPKG is not the clean way. |
Would adding these inside if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
I think we should try to pass to -DMSVC_RUNTIME_LIBRARY=MultiThreadedDLL when on Windows we use Conda. |
|
||
- name: Set dependencies install prefix dir for 32bit | ||
if: matrix.target-arch.name == 'Win32' | ||
run: | | ||
echo "SPARROW_DEPS_PREFIX=$VCPKG_INSTALLED_DIR" >> $GITHUB_ENV | ||
echo "SPARROW_INSTALL_PREFIX=$VCPKG_INSTALLED_DIR" >> $GITHUB_ENV | ||
echo "VCPKG_TARGET_TRIPLET='x86-windows'" >> $GITHUB_ENV | ||
echo "VCPKG_BUILD_TYPE='Release'" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove
According to the builds, it seems that we have to define _ITERATOR_DEBUG_LEVEL=0 when MSVC_RUNTIME_LIBRARY == MultiThreadedDLL |
To avoid the issues of Catch2 version on exotics architecture, can you introduce this following mechanism: set(DOWNLOAD_TEST_DEPENDENCIES ON CACHE BOOL "Download test dependencies")
if(DOWNLOAD_TEST_DEPENDENCIES)
Include(FetchContent)
message(STATUS "Downloading doctest")
FetchContent_Declare(doctest GIT_REPOSITORY https://github.com/onqtam/doctest GIT_TAG v2.4.11)
message(STATUS "Downloading catch2")
FetchContent_Declare(catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_TAG v3.7.1)
FetchContent_MakeAvailable(doctest catch2)
else()
find_package(doctest 2 REQUIRED)
find_package(catch2 3 REQUIRED)
endif()
|
Yes, I'll add both changes on Monday. |
@Gulin7 After some internal discussion, let's drop the CMake fetch solution. |
@Gulin7 Can you add me as collaborator on your branch ? I would like to push some commits |
6784821
to
f2b4cc6
Compare
31a341d
to
2683b29
Compare
@Gulin7 Thank you for your work! |
Fixed: #297
Tasks: